home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
26
/
3
/
DISK2631.ZIP
/
EXAMP1.ZIP
/
UMEX238.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-03-29
|
2KB
|
62 lines
'User's Manual Example, Page 238.
'T4.BAS--T4 bacteripphage animation demonstration
DEFINT a-z 'all variables are integers by default
DIM T42!(244),T4!(424) 'dimension two arrays
SCREEN 1, 0 'select screen modes
COLOR 0, 0 'select colors
'T4 is a bacteriophage-- a tiny organism that attacks bacteria.
'It reporduces by attaching to a bacterium, injecting its DNA,
'and taking over the reproductive system of the bacterium.
'This animation demonstrates the sequence graphically.
'Draw a bacterium: a big ellipse at the bottom of the screen.
CIRCLE (160,180),160,1,,,4/30
PAINT (160,170),1,1 'fill it in
CALL drawT4 'bacteriophage definition
FOR I = 1 TO 40 'each pass, the image is lowered a little
PUT (24 + I * 4, 22 + I * 2), T4!, XOR 'draw position 1
DELAY 0.2 'admire it
PUT (24 + I * 4, 22 + I * 2), T4!, XOR 'XOR to erase it
PUT (12 + I * 4, 37 + I * 2), T4!, XOR 'replace it with position 2
DELAY 0.2 'admire some more
PUT (12 + I * 4, 37 + I * 2), T4!, XOR 'this too shall pass
NEXT I
' At end of loop, nothing is on the screen, so we need to show
' the first image one more time.
PUT (24 + I * 4, 22 + I * 2), T4!, XOR
I = I + 1
DELAY 1
PAINT (I * 4 + 34, I * 2 + 40), 0, 3
DELAY 0.4
CIRCLE (160,180), 160,3,,,4/30
PAINT (160,170),2,3 'Infection takes over
DELAY 1
END
SUB drawT4
shared T4!(), T42!()
'----- first position of T4
DRAW "bm 20,50 c3"
DRAW "m-5,-9 m+0,-9 m+7,-8 m+7,0 m+7,+8 m+0,+9 m-5,+9 m-11,+0"
PAINT (24,40),2,3
LINE (18,50)-(33,52),3,BF
LINE (23,53)-(28,59),3,BF
LINE (20,59)-(31,63),3,BF
DRAW "bm 22,63 m-6,+12 bm 24,63 m-4,+12 bm 25,65 m+6,+12"
DRAW "bm 26,63 m+4,+12 bm 29,63 m+6,+12"
GET (14,20)-(42,80),T4!
PUT (14,20),T4!,XOR
'----- second position
DRAW "bm 20,54 c3"
DRAW "m-10,-7 m+0,-7 m+10,-4 m+12,0 m+10,+4 m+0,+7 m-10,+7 m-12,+0"
PAINT (24,45),2,3
LINE (18,54)-(33,56),3,BF
LINE (23,57)-(28,59),3,BF
LINE (20,59)-(31,63),3,BF
DRAW "bm 22,63 m-19,+5 bm 24,63 m-14,+7"
DRAW "bm 26,63 m+14,+7 bm 28,63 m+19,+5"
GET (2,35)-(50,75),T42!
PUT (2,35),T42!,XOR
END SUB